﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;


namespace Model
{

    #region Models

    public class ChangePasswordModel : IValidatableObject
    {
        [Required]
        [DataType(DataType.Password)]
        [DisplayName("原密码")]
        public string OldPassword { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("新密码")]
        public string NewPassword { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("确认新密码")]
        public string ConfirmPassword { get; set; }


        public System.Collections.Generic.IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (NewPassword != ConfirmPassword)
                yield return new ValidationResult("两次输入的密码不同", new string[] { "NewPassword", "ConfirmPassword" });
        }
    }

    public class LogOnModel 
    {
        [Required]
        [DisplayName("用户名")]
        public string UserName { get; set; }


        [Required]
        [DataType(DataType.Password)]
        [DisplayName("密码")]
        public string Password { get; set; }

        [Required]
        [DisplayName("企业名称")]
        [DropDownList("Sys_Enterprise", "Id", "EnterpriseName")]
        public Guid EnterpriseId { get; set; }

        [Required]
        [DisplayName("验证码")]
        [StringLength(4)]
        public string authcode { get; set; }

        [DisplayName("记住?")]
        public bool RememberMe { get; set; }

    }

    #endregion

}